import { ZFormItemSchema } from "@/components/Form/typings";
import {
  commaSeparateStringListRender,
  enumRender,
  secondsTimestampRender,
} from "@/components/Table/helpers/renders";
import { ZTableColumn } from "@/components/Table/typings";
import { hash2Options } from "@/utils";
import { EvaluationStatus } from "../helpers";

export const getColumns = (): ZTableColumn[] => [
  {
    title: "场景ID",
    key: "id",
  },
  {
    title: "业务场景",
    key: "config_name",
  },
  {
    title: "产品线",
    key: "biz_line",
  },
  {
    title: "状态",
    key: "status",
    render: enumRender(EvaluationStatus),
    filterMultiple: false,
    filterOptions: hash2Options(EvaluationStatus),
    filter: "default",
  },
  {
    title: "检测词表",
    key: "tables",
    render: commaSeparateStringListRender,
  },
  {
    title: "白名单词表",
    key: "white_tables",
    render: commaSeparateStringListRender,
  },
  {
    title: "模型",
    key: "model_names",
    render: commaSeparateStringListRender,
  },
  {
    title: "创建人",
    key: "creator",
  },
  {
    title: "创建时间",
    key: "create_time",
    render: secondsTimestampRender,
  },
];

export const getSearchSchemas = (): ZFormItemSchema[] => [
  {
    label: "场景名",
    path: "config_name",
    span: 16,
  },
];
